<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>补丁管理 - ROAS资源管理系统</title>
<style type="text/css">
<!--
.STYLE1 {
	color: #FFFFFF;
	font-weight: bold;
	font-size: 12px;
}

.STYLE6 {
	font-size: 12px;
}

.STYLE7 {
	font-size: 12px;
	background-color: #f5f5f5;
	margin: 0;
}

.STYLE9 {
	font-size: 12px;
	background-color: #ffffff;
	margin: 0;
}

.STYLE8 {
	color: #FFFFFF;
	font-weight: bold;
	font-size: 12px;
	background-color: #1C94C4;
	margin: 0;
}

body {
	margin: 0;
}

a:link {
	color: #0066FF;
	text-decoration: none;
}

a:visited {
	text-decoration: none;
	color: #0099FF;
}

a:hover {
	text-decoration: none;
}

a:active {
	text-decoration: none;
}
-->
</style>
<link href="../components/mmGrid/mmGrid.css" rel="stylesheet"
	type="text/css" media="all" />
<link href="../components/mmGrid/mmPaginator.css" rel="stylesheet"
	type="text/css" media="all" />
<script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../components/mmGrid/mmGrid.js"></script>
<script type="text/javascript" src="../components/mmGrid/mmPaginator.js"></script>
</head>


<body margin=0>
	<form id="form1" name="form1" method="get">
		<table width="99%" border="1" bordercolor="#F5F5F5">
			<tr>
				<td height="22" class="STYLE7">系统管理 &gt;账号浏览</td>
			</tr>
			<tr>
				<td><table width="100%" border="0">
						<tr>
							<td class="STYLE6">&nbsp;用户员： <input id="text01"
								name="textfield" type="text" /> <input type="button"
								name="Submit" value="查询" onclick="searchUser()" /></td>
						</tr>
					</table></td>
			</tr>
		</table>
	</form>
	<table id="userTable"  style="font-size:12px !important;">
			<tr >
				<th rowspan="" colspan=""></th>
			</tr>
	</table>
	<div id="userpg" style="text-align:right;margin-right:10px;font-size:12px;"></div>
</body>

<script type="text/javascript">
	function showEdit(username) {
		window.open('UsersEdit.html?id=' + username,'_blank','width=500,height=600,left=200,top=150,resizable=1,status=1');
		userGrid.load({username:$("#text01").val()});
	}
	function showControl() {
		window.open('UserControl.html','_blank','width=500,height=600,left=200,top=150,resizable=1,status=1');
	}
	
	function searchUser()
	{
		userGrid.load({username:$("#text01").val()});
		
	}
	var userCol = [
                  {title:'用户名',align: 'center', name:'username',width:140},
                 	{title:'性别',align: 'center', name:'sex',width:100},
					{title:'角色',align: 'center', name:'userrole',width:100},
					{title:'真实姓名',align: 'center', name:'realname',width:100},
					{title:'电话',align: 'center', name:'telephone',width:100},
					{title:'创建时间',align: 'center', name:'createdate',width:100},
					{title:'操作',name:'',align:'center',lockWidth:true,lockDisplay: true,renderer: function(val){
                        return '<button type="button" class="editUser">修改</button><button type="button" class="delUser">删除</button>';
                    }
					}
              ];
	var userGrid = $('#userTable').mmGrid({
        height: 300
		,width:'99%'
        , cols: userCol
        , url: '../user/userlist'
        , method: 'get'
        , root: 'data'
        , multiSelect: false
        , checkCol: false
        , fullWidthRows: true
        , nowrap: true
        , plugins: [
            $('#userpg').mmPaginator({limitList: [10, 20, 30,50]})
        ]
    });

	userGrid.on('cellSelected', function(e, item, rowIndex, colIndex){
        if($(e.target).is('.editUser')){
            e.stopPropagation();
            showEdit(item.username);
        }
        if($(e.target).is('.delUser')){
            e.stopPropagation();
            $.post("../user/delete",{username:item.username},function(json){
            	if(json)
            		{
            		alert("删除成功");
            		userGrid.load();
            		}
            });
        }
    });
</script>

</html>
